package com.imeth.cms.service.impl;

import com.imeth.cms.Picture;
import com.imeth.cms.dao.PictureDao;
import com.imeth.cms.service.PictureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by peter on 12/25/2015.
 */
@Service
public class PictureServiceImpl implements PictureService {

    @Autowired
    PictureDao pictureDao;

    public int save(List<Picture> pictures) {
        for (Picture picture : pictures) {
            pictureDao.save(picture);
        }
        return pictures.size();
    }

    public int batchDeleteByArticleId(Integer articleId) {
        return pictureDao.deleteByArticleId(articleId);
    }

    public List<Picture> queryByArticleId(Integer articleId) {
        return pictureDao.queryByArticleId(articleId);
    }
}
